<?php $this->load->view('layout/header'); ?>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <h3 class="page-title">旅游产品<small> 类别管理</small></h3>
            <?php echo breadcrumb(array('tourismgoods/grid' => '旅游产品', 'tourismgoodsexotic/grid' => '地区风情')); ?>
        </div>
    </div>
    <?php echo execute_alert_message() ?>
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-plus-sign"></i>地区风情</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body form">
                    <form class="form-horizontal line-form" action="<?php echo base_url('tourismgoodsexotic/editPost') ?>" method="post" enctype="multipart/form-data">
                        <div class="control-group">
                            <label class="control-label"><em>* </em>地区名称</label>
                            <div class="controls">
                                <input type="hidden" name="id" value="<?php echo $exotic->id;?>">
                                <input type="text" name="name" value="<?php echo $exotic->name;?>" class="m-wrap large required">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>所属城市</label>
                            <div class="controls">
                                <select name="region_id" class="m-wrap large required">
                                    <?php foreach ($regions as $region): ?>
                                    <option value="<?php echo $region['region_id'] ?>" <?php if ($region['region_id'] == $exotic->region_id) :?> selected="selected"<?php endif;?>><?php echo $region['region_name'] ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>简略描述</label>
                            <div class="controls">
                                <input type="text" name="abstract" value="<?php echo $exotic->abstract;?>" class="m-wrap large required">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>地区描述</label>
                            <div class="controls">
                                <textarea name="describe" class="span7 required" rows="4"><?php echo $exotic->describe;?></textarea>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>导航图</label>
                            <div class="controls">
                                <div class="file-image" style="width: 120px;height: 120px;float: left;">
                                    <img src="<?php echo $this->config->show_image_url($exotic->picture)?>" width=110 height="100">
                                </div>
                                <input type="file" name="picture">
                                <input type="hidden" name="picture" value="<?php echo $exotic->picture ?>">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>列表图</label>
                            <div class="controls">
                                <div class="file-image" style="width: 120px;height: 120px;float: left;">
                                    <img src="<?php echo $this->config->show_image_url($exotic->images)?>" width=110 height="100">
                                </div>
                                <input type="file" name="images">
                                <input type="hidden" name="images" value="<?php echo $exotic->images ?>">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>地区广告</label>
                            <div class="controls">
                                <textarea name="advert" class="textarea-multipart-edit"><?php echo $exotic->name;?></textarea>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">排序</label>
                            <div class="controls">
                                <input type="text" name="sort" value="<?php echo $exotic->sort;?>" class="m-wrap large">
                            </div>
                        </div>
                        <div class="form-actions">
                            <button class="btn green" type="submit"><i class="icon-ok"></i> 保存</button>
                            <a href="<?php echo base_url('tourismgoodsexotic/grid') ?>">
                                <button class="btn" type="button">返回</button>
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $this->load->view('layout/footer'); ?>
<script type="text/javascript">
    $('.form-horizontal').on('change', 'input[type=file]', function (e) {
        var $this = $(this);
        upLoadImg(e.currentTarget.files[0], function (obj) {
            console.log(obj);
            $this.siblings('[type=hidden]').val(obj.save_path);
            $this.siblings('.file-image').children('img').attr('src', obj.file_url);
        });
    });
</script>
